package com.jumi.microservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jm.member.common.core.web.page.TableDataInfo;
import com.jumi.microservice.dto.reponse.FenXiaoReponse;
import com.jumi.microservice.dto.request.SalesQueryRequest;
import com.jumi.microservice.service.IJmUserSalesService;
import com.jumi.microservice.service.PageService;
import com.jumi.microservice.util.WrapperUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户业绩表 前端控制器
 * </p>
 *
 * @author 要挑客户管理团队
 * @since 2020-07-14
 */
@RestController
@RequestMapping("/jm-user-sales")
@Api(value = "用户业绩",tags = {"用户业绩接口"})
public class JmUserSalesController {

    @Autowired
    IJmUserSalesService salesService;

    @PostMapping("/getSalesDataInfo")
    @ApiOperation("用户业绩分页数据")
    public TableDataInfo<FenXiaoReponse> getSalesDataInfo(SalesQueryRequest request,
                                                          Integer size, Integer current){
        Page page=new Page(current,size);
        QueryWrapper wrapper= WrapperUtil.getWrapper(null,request);
        wrapper.orderByDesc("id");
        page=salesService.getPage(page,wrapper);
        return PageService.getDataTableInfo(page);
    }
}
